package model;

import java.util.List;

import controller.DataBaseInteactor;


/**
 * 
 * @author Richard Lee
 * @version 
 * edited by Brendan Ng
 */
public class ProgramChair {
	private final String firstName;
	private final String lastName;
	private final String username;
	private final String password;
	
	private final DataBaseInteactor interactor;
	
	/**
	 * Conference that this Program Chair is working on.
	 */
	Conference conference;
	
	/**
	 * Create a program chair with the given first/last name, username and password.
	 * 
	 * @param theFirstName
	 * @param theLastName
	 * @param theUsername
	 * @param thePassword
	 * @param theInteractor
	 */
	public ProgramChair(String theFirstName, String theLastName, String theUsername, String thePassword,
			DataBaseInteactor theInteractor) {
		firstName = theFirstName;
		lastName = theLastName;
		username = theUsername;
		password = thePassword;
		interactor = theInteractor;
		// my_conference = passed in conference.
		// I think the constructor will need conference.
		// and will have access to conference with 
	}
	
	/**
	 * Create a program chair with the given username and password.
	 * The first/last names are initialized to be empty strings.
	 * 
	 * @param theUsername
	 * @param theInteractor
	 */
	public ProgramChair(String theUsername, DataBaseInteactor theInteractor) {
		username = theUsername;
		password = "";
		firstName = "";
		lastName = "";
		interactor = theInteractor;
	}
	
	/**
	 * Get the first name.
	 * @return The first name
	 */
	public String getFirstName() {
		return firstName;
	}
	
	/**
	 * Get the first name from the given username.
	 * @param theUsername The username
	 * @return The first name
	 */
	public String getFirstName(String theUsername) {
		return interactor.getFirstName(theUsername);
	}
	
	/**
	 * Get the last name.
	 * @return The last name
	 */
	public String getLastName() {
		return lastName;
	}
	
	/**
	 * Get the last name from the given username
	 * @param theUsername the username
	 * @return The last name
	 */
	public String getLastName(String theUsername) {
		return interactor.getLastName(theUsername);
	}
	
	/**
	 * Get the username.
	 * @return The username
	 */
	public String getUsername() {
		return username;
	}
	
	/**
	 * Get the password.
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}
	
	/**
	 * Set the conference of the program chair.
	 * @param theConference The conference
	 */
	public void setConference(Conference theConference) {
		conference = theConference;
	}
	
	/**
	 * Get the program chair's conference.
	 * @return The program chair's conference
	 */
	public Conference getConference() {
		return conference;
	}
	
	/**
	 * Get a list of statuses for every manuscript in the given conference.
	 * 
	 * @param theConference The conference to look under
	 * @return A list of status' for each manuscript
	 */
	public List<String> getStatus(Conference theConference) {
		//access to conference, return the list of manuscript. 
		//if the method is asking for actual acceptance, feels like I have to return
		//something else then list of document. 
		//I understand there document has acceptance field among themselves.xx 	
		return interactor.getStatus(theConference);
	}

	/**
	 * Get the status of the given manuscript.
	 * 
	 * @param theConference The conference to look under
	 * @param theManuscript The manuscript to look up
	 * @return The status of the manuscript
	 */
	public String getStatus(Conference theConference, Manuscript theManuscript) {
		return interactor.getStatus(theConference, theManuscript);
	}
	

	/**
	 * 
	 * @param theConference The conference to look under
	 * @param theAuthorUN The author's username
	 * @param theManTitle The manuscript title
	 * @param theStatus The status to be set
	 * @return true if successful and false otherwise
	 */
	// Status was boolean in UML but changed to String since 
	//Manuscript asks string type for status.
	public boolean setStatus(Conference theConference, String theAuthorUN, String theManTitle, String theStatus) {  
		return interactor.setStatus(theConference, theAuthorUN, theManTitle, theStatus);
	}
	
	/**
	 * Get a list of all paper titles in a given conference.
	 * 
	 * @param theConference The conference to look under
	 * @return A list of all paper titles
	 */
	public List<String> getPaperTitles(Conference theConference) {
		return interactor.getPaperTitles(theConference);
	}
	
	public String getManuscriptContents(final Author theAuthor, final Conference theConference, final String theTitle) {
		return interactor.getManuscriptContents(theAuthor, theConference, theTitle);
	}
	
	/**
	 * Assign the specified sub program chair to the given conference.
	 * 
	 * @param theConference The conference to look under
	 * @param theSubProgramChairUN The sub program chair to assign
	 * @return true if successful and false otherwise
	 */
	public boolean assignSubProgramChair(Conference theConference, String theSubProgramChairUN) {
		return interactor.assignSubProgramChair(theConference, theSubProgramChairUN);
	}
	
	/**
	 * Designate a sub program chair for the given manuscript.
	 * 
	 * @param theConference The conference to look under
	 * @param theSubProgramChair The sub program chair to be designated
	 * @param theAuthorUN The author's username
	 * @param theManTitle The manuscript to designate
	 * @return true if designation was successful and false otherwise
	 */
	public boolean designateSubMan(Conference theConference, SubProgramChair theSubProgramChair, String theAuthorUN,
			String theManTitle) {
		return interactor.designateSubMan(theConference, theSubProgramChair, theAuthorUN, theManTitle);
	}
	
	/**
	 * Get a list of all sub program chairs in the given conference.
	 * 
	 * @param theConference The conference to look under
	 * @return A list of all sub program chairs
	 */
	public List<String> getSubProgramChairs(Conference theConference) {
		return interactor.getSubProg(theConference);
	}
	
	public String getSubPCManuscripts(Conference theConference, Manuscript theManuscript) {
		return interactor.getSubProgMan(theConference, theManuscript);
	}
}
